import { ApiProperty } from "@nestjs/swagger";
import { Column, Entity, PrimaryGeneratedColumn, OneToOne, UpdateDateColumn, DeleteDateColumn, CreateDateColumn } from "typeorm";
import { Account } from "./account.entity";

@Entity('user_tb')
export class User {
    @ApiProperty({ name: '用户id' })
    @PrimaryGeneratedColumn({ type: 'bigint', name: 'user_id', comment: '用户id' })
    user_id: number;
    @OneToOne(()=> Account, (account) => account.user, {createForeignKeyConstraints: false})
    account: Account;
    @ApiProperty({ name: '用户昵称'})
    @Column({ default: null, comment: '昵称'})
    nick_name: string;
    @ApiProperty({ name: '用户手机号'})
    @Column({ default: null, comment: '手机号'})
    phone: string;
    @ApiProperty({ name: '用户邮箱'})
    @Column({ default: null, comment: '邮箱账号'})
    email: string;
    @ApiProperty({ name: '头像链接'})
    @Column({ default: 'http://127.0.0.1:3000/images/1701333013340.png', comment: '头像地址' })
    avatar: string;
    @ApiProperty({ name: '身份证号码' })
    @Column({ default: null, comment: '身份证号'})
    idcard: string;
    @ApiProperty({ name: '性别' })
    @Column({ default: 0 , comment: '性别 0未知、1男、2女' })
    sex: string;
    @ApiProperty({ name: '个性签名' })
    @Column({ default: null, comment: '个性签名' })
    sing: string;
    @Column({ default: 0, comment: '用户状态 0 正常 1 禁用' })
    status: number;
    @Column({ default: 1 })
    uuid: string;
    @Column({ default: null })
    openid: string;
    @CreateDateColumn()
    create_time: Date;
    @UpdateDateColumn()
    update_time: Date;
    @DeleteDateColumn({select: false})
    del_time: Date;
}
